<script type="text/javascript" src="/js/prototype.js"></script>
<div class="row">
 <small>
  <div class="span12">
   <div class="clearfix txtleft search" style="background-color:#f8f8f8; padding:10px; margin:10px 0px;"> 
      <form action="/<*$controller*>/student" method="get"   name="form1" class="form-horizontal">       
		  机构:<select id="jigou" name="groups"  onchange="getSchool(this.value)"></select>
          校园:<select id="school" name="school"  onchange="getClass(this.value)"></select> 
          班级:<select id="class1" name="class" ></select>  
          姓名:<input  type="text" id="cnname" name="cnname" value="<*$cnname*>"  class="span2" ></input> 
         <input type="submit" class="btn btn-success"  value="查询"  >
         <input type="button" class="btn btn-success" value="清空查询" onclick="window.location='/user/student'" >
      </form>
	</div>	 
  	<div class="table_content">
		<div class="ta_top"></div>
		<div class="ta_in">
   <*if $result|@count neq 0*>  
   <table cellpadding="0" cellspacing="0" class="table">
		<tr> 
			<th class="span3">所属机构</th>
            <th class="span2">所属校园</th>
			<th class="span2">所属班级</th>
			<th class="span2">姓名</th>
<!--			<th class="span1">昵称</th>
-->			<th class="span1">生日</th>   
			<th class="span1">性别</th> 
			<th class="span4">已购服务</th> 
			<th class="span2">春雨开通</th> 
            <th  class="span3">操作</th>
			<th>&nbsp;</th>
		</tr>
      
    <*foreach from=$result item=a key =key name=foo*>
    <*eval var=$a.schoolid assign="schoolid"*>
		<tr> 
			<td><*$a.groupname*></td>
            <td><*$a.schoolname*></td>
			<td><*$a.classname*></td>
			<td><*$a.cnname*></td>
<!--			<td><*$a.nikename*></td>
-->			<td><*$a.birthday*></td>
			<td><*if $a.sex eq 1*>男<*else if $a.sex eq 2*>女<*/if*></td> 
            <td><*if $service.$schoolid*>基础服务&nbsp;<*$service.$schoolid.start_time|date_format:"%Y-%m-%d" *>~<*$service.$schoolid.end_time|date_format:"%Y-%m-%d" *><*if $service.$schoolid.isopen_chunyu*>(含春雨)<*/if*><*/if*></td>
			<td><*if $a.isopen eq 1*><span style="color:#00F">是</span><*else*><span style="color:#F00">否</span><*/if*></td> 
            <td>
            <a role="button" class="btn btn-primary" data-toggle="modal" onclick="javascript:editit('<*$a.uid_student*>','<*$pageNum*>','<*$groups*>','<*$school_id*>','<*$classid*>')"><i class="icon-pencil icon-white"> </i> 修改</a>
    
        <button type="button" class="btn  btn-small"   onclick="window.location='/<*$controller*>/oneparents/id/<*$a.pid*>/page/<*$pageNum*>/groups/<*$groups*>/school/<*$school_id*>/class/<*$classid*>'">家长</button> 
         
<!--          <a role="button" class="btn" data-toggle="modal" onclick="javascript:deletestunew(<*$a.uid_student*>, <*$a.uid_class*>,<*$groups*>,'<*$school_id*>',<*$classid*>,<*$pageNum*>)"><i class="icon-remove"> </i> 删除</a> 
      onclick="window.location='/<*$controller*>/haveparents/id/<*$a.pid*>/page/<*$pageNum*>'"  -->
     
            </td>
            <td>&nbsp;</td>
		</tr> 
        
		<*/foreach*>
       <tr>
        	<td colspan="8"><*$page*></td>
            <td>&nbsp;</td>
        </tr>
      <*else*>  
          <tr>
        	<td colspan="8"> 没有您要的结果,请改变你的搜索条件！</td>
            <td>&nbsp;</td>
        </tr> 
        
        <*/if*>
        </table>
        </div>
    <div class="ta_bottom"></div>
	  </div>
     
    </div>
    </small> 
  
<script type="text/javascript"> 

  window.onload=function(){
	 jigou(); 

	if('<*$groups*>' != ''){
		getSchool('<*$groups*>');
	}
	if('<*$school_id*>' != ''){
		getClass('<*$school_id*>');
	}

 } 
function jigou()
{  

	var url     = '/<*$controller*>/groups/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '';
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_course});

} 
function showResponse_course(originalRequest)
{
	{  //alert(originalRequest.responseText);  
		 document.all.form1.groups.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$groups*>' != ''){
			 jsSelectIsExitItem(document.all.form1.groups,'<*$groups*>');
	        } 
	 }

}  

function getSchool(a)
{  
	var url  = '/<*$controller*>/schoollist/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '&id=' + a;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_school});

} 
function showResponse_school(originalRequest)
{
	{    //alert(originalRequest.responseText);  
		 document.all.form1.school.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$school_id*>' != ''){
				jsSelectIsExitItem(document.all.form1.school,'<*$school_id*>');
			}
	 } 
}  
function getClass(a)
{  
     
	var url  = '/<*$controller*>/classlist/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '&id=' + a;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_class});

} 
function showResponse_class(originalRequest)
{
	{    //alert(originalRequest.responseText);  
		 document.all.form1.class.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$classid*>' != ''){
				jsSelectIsExitItem(document.all.form1.class,'<*$classid*>');
			}
	 } 
}  

function deleteit(stuid,cid,groupid,schoolid,classid)
{
  if(confirm("删除将不能恢复")){
   window.location='/<*$controller*>/delete/stuid/'+stuid+'/cid/'+cid+'/groupid/'+groupid+'/schoolid/'+schoolid+'/classid/'+classid;
   }
}

function editit(id,pageNum,groupid,schoolid,classid)
{ 
 	window.location='/<*$controller*>/editstudent/id/'+id+'/pageNum/'+pageNum+'/groupid/'+groupid+'/schoolid/'+schoolid+'/classid/'+classid;
}
 
 
 
 
 
 function deletestunew(stuid,cid,groupid,schoolid,classid,pageNum)
{
  if(confirm("删除将不能恢复")){
   window.location='/<*$controller*>/deletestunew/stuid/'+stuid+'/cid/'+cid+'/groupid/'+groupid+'/schoolid/'+schoolid+'/classid/'+classid+'/pageNum/'+pageNum;
   }
}

 
 
 
 
 
 function jsSelectIsExitItem(objSelect, objItemValue) {
	//alert(objSelect.options.length);
    for (var i = 0; i < objSelect.options.length; i++) {
        if (objSelect.options[i].value == objItemValue) { 
			objSelect.options[i].selected=true;
        	 break;
        }
    }
    return 1;
}  
 
 function addit(id){
	$(document).ready(function(){
	 //  $(".addnew").click(function(){ // Click to only happen on announce links
		 $("#account").val(id);
		 $('#myModal').modal('show');
	  // });
	});
				
} 
 
 
 
</script>
 </div> 